/*
 * @Author: szx
 * @Date: 2022-01-11 13:52:07
 * @LastEditTime: 2022-01-11 13:57:36
 * @Description:
 * @FilePath: \leetcode\700-799\746\746.js
 */
/**
 * @param {number[]} cost
 * @return {number}
 */
var minCostClimbingStairs = function (cost) {
    const n = cost.length;
    for (let i = 2; i < n; i++) cost[i] += cost[i - 1] < cost[i - 2] ? cost[i - 1] : cost[i - 2];
    return Math.min(cost[n - 1], cost[n - 2]);
};
